﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Htss.Platform.Web;
using Htss.Platform.Data;

namespace DreamBox.Web.Box
{
    public class portalBox:ControllerBox
    {
        public ActionResult Load()
        {
            string t = RequestContext.RouteData.Values["id"] != null ? RequestContext.RouteData.Values["id"].ToString() : "";
            ViewData["type"] = t;
            string where = "";
            string time = DateTime.Now.AddDays(-7).ToString();
            switch (t)
            {
                case "plus":
                    where = " and PostDate>='" + time + "' order by Plus desc";
                    break;
                case "reply":
                    where = " and PostDate>='" + time + "' order by ReplyCount desc";
                    break;
                case "hot":
                    where = " and PostDate>='" + time + "' order by BrowseCount desc";
                    break;
                default:
                    where = " order by PostsID desc";
                    break;
            }
            DbAction db = new DbAction();
            //文章数据加载

            ViewDbTable["ListData"] = db.SelectForReader("select  top 10 * from  dbox_v_posts where IsStatus=1" + where);
            //网址数据
            return View("portal");
        }
    }
}
